package com.yc.ssq.servlet;

import com.yc.ssq.Util.Utils;
import com.yc.ssq.dao.SsqDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Map;

@WebServlet(name = "QueryServlet", value = "/query.s")
public class QueryServlet extends HttpServlet {

    private SsqDao dao = new SsqDao();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String begin = request.getParameter("begin");
        String end = request.getParameter("end");
        String page = request.getParameter("page");
        String size = request.getParameter("size");

        Integer ipage = Integer.valueOf(page);
        Integer isize = Integer.valueOf(size);

        Map<String, Object> map = dao.selectPage(begin, end, ipage, isize);
        Utils.writeJson(map, response);

    }


}
